home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / cenvi2.arj / DEVICES.CMD < prev    next >
OS/2 REXX Batch file  |  1993-07-29  |  2KB  |  44 lines

  1. EXTPROC CEnvi
  2. /**************************************************************
  3.  *** Devices - Get information about attached devices using ***
  4.  ***           DosDevConfig() calls.                        ***
  5.  **************************************************************/
  6.  
  7. #define DEVINFO_PRINTER       0  // Number of attached printers.
  8. #define DEVINFO_RS232         1  // Number of RS232 ports.
  9. #define DEVINFO_FLOPPY        2  // Number of diskette drives.
  10. #define DEVINFO_COPROCESSOR   3  // Presence of math coprocessor hardware:
  11.                                  //  0 = No coprocessor hardware.
  12.                                  //  1 = Coprocessor hardware installed.
  13. #define DEVINFO_SUBMODEL      4  // PC Submodel Type.  The returned
  14.                                  // information is the system submodel byte.
  15. #define DEVINFO_MODEL         5  // PC Model Type.  The returned information
  16.                                  // is the system model byte.
  17. #define DEVINFO_ADAPTER       6  // Type of primary display adapter:
  18.                                  //  0 = Monochrome or printer adapter.
  19.                                  //  1 = Other.
  20.  
  21. printf("Device configuration for your system:\n");
  22. printf("  Printer count: %d\n",GetDosDevConfig(DEVINFO_PRINTER));
  23. printf("  RS232 port count: %d\n",GetDosDevConfig(DEVINFO_RS232));
  24. printf("  Floppy drive count: %d\n",GetDosDevConfig(DEVINFO_FLOPPY));
  25. printf("  Math coprocessor installed: %s\n",
  26.        GetDosDevConfig(DEVINFO_FLOPPY) ? "YES" : "NO" );
  27. printf("  PC Model: %d\n",GetDosDevConfig(DEVINFO_MODEL));
  28. printf("  PC Submodel: %d\n",GetDosDevConfig(DEVINFO_SUBMODEL));
  29. printf("  Primary display adapter: %s\n",
  30.        GetDosDevConfig(DEVINFO_FLOPPY) ? "Color" : "Monochrome" );
  31.  
  32.  
  33. GetDosDevConfig(DeviceType)   // call DosDevConfig() to return the value for
  34. {                             // requested DeviceType.
  35.    BLObSize(DeviceInfo,100);  // make it big in case a lot of data is returned
  36.    #define ORD_DOS32DEVCONFIG 231
  37.    rc = DynamicLink("doscalls",ORD_DOS32DEVCONFIG,BIT32,CDECL,
  38.                     DeviceInfo,DeviceType)
  39.    assert( 0 == rc );
  40.    // all known DeviceTypes get a byte returned about their info
  41.    return( BLObGet(DeviceInfo,0,UWORD8) );
  42. }
  43.  
  44.